<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css" >
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css">
    <link rel="stylesheet" href="__CSS__/daterangepicker.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="__CSS__/bootstrap-select.min.css">

    <style>
        .title_box{
            width: 100%;
            height: 35px;
            font-size: 24px;
            color: #3c8dbc;
            text-indent: 10px;
            line-height: 35px;
            font-weight: bold;
            border-bottom: 1px solid #ccc;
            margin: 20px auto;
            text-align: center;
        }
        .layui-box{
            display: flex;
            flex-flow: row wrap;
            width: 100%;
        }
        .layui-box>div{
            width: 20%;
            height: 35px;
            margin-bottom: 10px;
        }
        .litter-layui{
            width: 100%;
            height:35px;
            display: flex;
            flex-flow: row nowrap;
        }
        .litter-layui label{
            width:100px ;
            height: 35px;
            line-height: 35px;
            padding:0;
            margin:0;
            text-align: left;
        }
        .litter-layui>div{
            width: 75%;
            height: 35px;
            display: inline-block;
        }
        .litter-layui>div input{
            height: 35px;
            width: 100%;
            padding:0;
        }
    </style>
</head>
<body>
    <div class="title_box">分配专员</div>
    <div class="wrapper">
        <div class="panel-body">
            <!--<form class="layui-form" action="{:url('fenpei')}" method="get">-->
            <form class="layui-form" action="{:url('fenpei_dingdan')}" method="get">
                <div class="layui-form-item row layui-box">

                    <!--<input type="hidden" name="act" value="{$act}" >-->

                    <div class="layui-form col-md-6 litter-layui">
                        <label class="layui-form-label" style="width: 100px;">状态</label>
                        <div class="layui-input-inline">
                            <select name="ywstate"  lay-search="">
                                <option value="0">全部</option>
                                {volist name='ywstate' id='data'}
                                    <option value="{$data.id}" {eq name="form['ywstate']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form col-md-6 litter-layui">
                        <label class="layui-form-label" style="width: 100px;">渠道</label>
                        <div class="layui-input-inline">
                            <select name="qudao"  lay-search="">
                                <option value="0">全部</option>
                                {volist name='qudao' id='data'}
                                <option value="{$data.id}" {eq name="form['qudao']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form col-md-6 litter-layui">
                        <label class="layui-form-label" style="width: 100px;">区域</label>
                        <div class="layui-input-inline">
                            <select name="area"  lay-search="" id="area" lay-filter="area">
                                <option value="0">全部</option>
                                {volist name='area' id='data'}
                                <option value="{$data.id}" {eq name="form['area']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form col-md-6 litter-layui">
                        <label class="layui-form-label" style="width: 100px;" >医院</label>
                        <div class="layui-input-inline">
                            <select name="yiyuan[]"  id="yiyuan" lay-ignore class="selectpickers" multiple  data-size="10" data-width="85%"   >
                                <!--<option value="0">全部</option>-->
                                {volist name='yiyuan' id='data'}
                                <option value="{$data.id}" {in name="data.id" value="$form['yiyuan']"}selected="selected"{/in} >{$data.name|msubstr=0,10}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form  col-md-6 litter-layui" >
                        <label class="layui-form-label" style="width: 100px;">预产期</label>
                        <div class="layui-input-inline">
                            <input type="text" class="form-control form-time" id="yctime" name="yctime" value="{$form.yctime}"  >
                        </div>
                    </div>
                    <div class="layui-form  col-md-6 litter-layui" >
                        <label class="layui-form-label" style="width: 100px;">建单时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="form-control form-time" id="jdtime" name="jdtime" value="{$form.jdtime}"  >
                        </div>
                    </div>
                    <!--<div class="layui-form col-md-6 " >-->
                        <button class="layui-btn" lay-submit="*" lay-filter="demo1">查询</button>
                        <!--<button class="layui-btn" lay-submit="*" lay-filter="demo1" type="reset">重置</button>-->
                    <!--</div>-->
                </div>
            </form>



            <!--<form  id="commentForm" method="post" action="{:url('fenpei')}" class="layui-form">-->
            <form  id="commentForm" method="post" action="{:url('fenpei_dingdan')}" class="layui-form">
                <div class="layui-form">
                    <table class="layui-table">
                        <colgroup>
                            <col width="80">
                            <col>
                        </colgroup>
                        <thead>
                        <tr>
                            <th>全部<br><input type="checkbox"  lay-skin="primary" lay-filter="allChoose"></th>
                            <th>ID</th>
                            <th>顾客姓名</th>
                            <th>妈妈电话</th>
                            <th>家人电话</th>
                            <th>渠道</th>
                            <th>区域</th>
                            <th>医院</th>
                            <th>业务状态</th>
                            <th>预产期</th>
                            <th>建单时间</th>
                        </tr>
                        </thead>
                        <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td><input type="checkbox" name="ids[]" lay-skin="primary" value="{$vo.id}"></td>
                                <td>{$vo.id}</td>
                                <td>{$vo.name}</td>
                                <td>{$vo.maphone}</td>
                                <td>{$vo.otherphone}</td>
                                <td>{$vo.qdxx_text}</td>
                                <td>{$vo.area_text}</td>
                                <td>{$vo.yyxx_text}</td>
                                <td>{$vo.state_text}</td>
                                <td>{neq name='vo.yctime' value='1970-01-01'}{$vo.yctime}{/neq}</td>
                                <td>{neq name='vo.jdtime' value='1970-01-01 8:00'}{$vo.jdtime}{/neq}</td>
                            </tr>
                            {/volist}
                        </tbody>
                    </table>
                </div>
                <!--<input type="hidden" name="act" value="{$act}" >-->
                <!--<input type="hidden" name="khd" value="1" >-->

                <div class="layui-form" style="margin-top: 25px;">
                    <div class="row">
                        <label class="layui-form-label" style="width: auto;">请选择邀约客服</label>
                        <div class='col-sm-2 col-lg-3 col-md-3'>
                            <div class="form-group">
                                <select name="yykf" lay-verify="required" lay-search="">
                                    <option value="">请选择邀约客服</option>
                                    {volist name='yykf' id='data'}
                                    <option value="{$data.id}" >{$data.username}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <label class="layui-form-label" style="width: auto;">请选择短信发送时间</label>
                        <div class='col-sm-3 col-lg-3 col-md-3'>
                            <input type='text' class="form-control" name="automsgtime" id='datetimepicker4' lay-verify="required" />
                        </div>
                        <button class="layui-btn layui-btn-normal" lay-filter="*" lay-submit>批量分配</button>
                    </div>
                </div>

            </form>
            <div class="page pull-right">{$page}</div>
        </div>

    </div>

    <script type="text/javascript" src="__JS__/jquery-2.2.3.min.js"></script>
    <script type="text/javascript" src="__STATIC__/layui/layui.js"></script>
    <script type="text/javascript" src="__JS__/moment.js"></script>
    <script type="text/javascript" src="__JS__/daterangepicker.js"></script>
    <script type="text/javascript" src="__JS__/date.js"></script>
    <script src="//cdn.bootcss.com/moment.js/2.18.1/locale/zh-cn.js"></script>
    <script type="text/javascript" src="//cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>

    <!--<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>-->
    <script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
    <script type="text/javascript" src="__JS__/bootstrap-select.min.js"></script>


    <script type="text/javascript">
        $(function () {
            $('.selectpickers').selectpicker();
            $('#datetimepicker4').datetimepicker({
                format: 'YYYY-MM-DD HH:ss',
                defaultDate : new Date(),
                minDate: new Date()
            });
        });
    </script>

    <script>
        layui.use('form', function(){
            var $ = layui.jquery, form = layui.form();
            //全选
            form.on('checkbox(allChoose)', function(data){
                var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
                child.each(function(index, item){
                    item.checked = data.elem.checked;
                });
                form.render('checkbox');
            });

            form.on('select(area)',function (data) {
                $.post("/admin/yewu/getyiyuan?area="+data.value, function(data){
                    var optionstring = "";
                    if(data.code!=0){
                        $.each(data, function(i,item){
                            if(item.name.length > 10){
                                item.name = item.name.substr(0,10);
                            }
                            optionstring += "<option value=\"" + item.id + "\"  >" + item.name + "</option>";
                        });
                        $("#yiyuan").empty();
                        $("#yiyuan").append(optionstring);
                        $('.selectpickers').selectpicker('render');
                        $('.selectpickers').selectpicker('refresh');
                    }
                });
            });

            form.on('submit(*)', function (data) {
                $.ajax({
                    url: data.form.action,
                    type: data.form.method,
                    data: $(data.form).serialize(),
                    success: function (msg) {
//                        console.log(msg);
                        layer.msg(msg.msg, {icon: msg.icon});
                        setTimeout(function(){
                            location.href=msg.url;
                        },3000);
                    }
                });
                return false;
            });
        });
    </script>


</body>
</html>